package com.atguigu.dao.impl;

import com.atguigu.dao.UserDao;
import com.atguigu.pojo.User;

public class UserDaoImpl extends BaseDao implements UserDao {
    @Override
    public User queryUserByusername(String username) {
        String sql = "select id,username,PASSWORD,email from t_user where username= ? ";

        return queryForone(User.class,sql,username);

    }

    @Override
    public User queryUserByusernameAndPassword(String username, String PASSWORD) {
        String sql = "select id,username,PASSWORD,email from t_user where username= ? and PASSWORD=?";
        return queryForone(User.class,sql,username,PASSWORD);
    }

    @Override
    public int saveuser(User user) {
        String sql ="insert into t_user(username,PASSWORD,email) values(?,?,?)";
        return updata(sql,user.getUsername(),user.getPASSWORD(),user.getEmail());
    }
}
